import {Request, Response, NextFunction} from 'express';
import HttpException from '../exceptions/HttpException';
import { INTERNAL_SERVER_ERROR } from 'http-status-codes';
export default function errorMiddleware(err: HttpException, _req:Request , res: Response, _next: NextFunction) {
    res.status(err.status || INTERNAL_SERVER_ERROR)
    .send({
        success: false,
        message: err.message,
        errors: err.errors
    });
}